package cn.myframe.service.sys.impl;

import cn.myframe.dao.sys.SysParameterDao;
import cn.myframe.entity.sys.SysParameterEntity;
import cn.myframe.redis.RedisService;
import cn.myframe.service.BaseServiceImpl;
import cn.myframe.service.sys.SysParameterService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("sysParameterService")
public class SysParameterServiceImpl extends BaseServiceImpl<SysParameterDao,SysParameterEntity> implements SysParameterService {
	@Autowired
	private RedisService redisService;
	@Autowired
	private SysParameterDao sysParameterDao;

    @Override
    public String getValue(String key) {
		String val = (String) redisService.hmGet("syspara:", key);
		if (StringUtils.isEmpty(val)) {
			val = baseMapper.getValue(key);
		}
        return val;
    }

	@Override
	public SysParameterEntity queryByKey(String key) {
		// TODO Auto-generated method stub
		return sysParameterDao.queryByKey(key);
	}
}

